/**
 * Created by chensk740 on 2018/1/3.
 */
import {Component, EventEmitter, Input, OnDestroy, OnInit, Output, ViewEncapsulation} from '@angular/core';
import {ActivatedRoute, Router} from "@angular/router";
import {Subject, Observable, BehaviorSubject} from 'rxjs';
import {ImageServeService} from "app/shared/service/image/image-serve.service";

@Component({
  selector: 'one-pic-item',
  templateUrl: './one-pic-item.component.html',
  styleUrls: ['./one-pic-item.component.scss'],
  encapsulation: ViewEncapsulation.None
})
export class OnePicItemComponent implements OnInit, OnDestroy {
  @Output() onclick= new EventEmitter();
  public ngUnsubscribe: Subject<void> = new Subject<void>();
 @Input()  itemData;
  constructor(
              public route: ActivatedRoute,
              public imgService: ImageServeService,
              private router: Router,
  ) {
    this.route.queryParams.subscribe(param => {
    });
  }

  /**
   * @description 获取图标
   * @param iconName 图标名
   * @author chensk740
   * @date 2018-1-11
   */
  getIcon(iconName: string) {
    return this.imgService.getIcon(iconName);
  }
  /**
   * @description 跳转到详情
   * @param id 内容id
   * @author chensk740
   * @date 2018-1-11
   */
  goToTarget(article) {
    this.onclick.emit(article);
  }
  ngOnInit() {
  }


  ngOnDestroy() {
    this.ngUnsubscribe.next();
    this.ngUnsubscribe.complete();
  }
}
